package com.heo.server;

import io.netty.channel.Channel;
import io.netty.channel.socket.SocketChannel;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * Created by zhangcf
 * 本类是用来存放通过控制台登录验证的链接
 */
public class ConsoleChannelMap
{
  /**
   * 结构
   * channelId,SocketChannel
   */
  private static Map<String, SocketChannel> map = new ConcurrentHashMap<String, SocketChannel>();//线程安全对象

  public static void add(String clientId, SocketChannel socketChannel)
  {
    map.put(clientId, socketChannel);
  }

  public static Channel get(String clientId)
  {
    return map.get(clientId);
  }
  
  public static int getSize()
  {
    return map.size();
  }
  
  public static void remove(String clientId)
  {
    map.remove(clientId);
  }

}
